package com.zijie.hosptal.mapper;

import ch.qos.logback.core.net.SMTPAppenderBase;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zijie.hosptal.pojo.dto.Account;
import com.zijie.hosptal.pojo.po.Admin;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface AdminMapper extends BaseMapper<Admin> {
   default Page<Admin> list(Page<Admin> page, Admin admin){
       LambdaQueryWrapper<Admin> wrapper = Wrappers.lambdaQuery(admin);
       return selectPage(page,wrapper);
   }

   @Select("select id,username,password from admin where username = #{username}")
   Admin getByUsername(Account account);


   @Select("select id,username from admin where id = #{id}")
    Admin getById(Integer id);
}
